<template>
  <div class="time-bank">
    <div class="page-header">
      <h1>互助养老时间银行</h1>
      <p class="subtitle">今天的付出，是明天的保障</p>
    </div>

    <div class="dashboard">
      <!-- 积分概览 -->
      <div class="points-overview">
        <div class="points-card">
          <div class="points-icon">
            <font-awesome-icon icon="clock" />
          </div>
          <div class="points-info">
            <span class="points-value">128</span>
            <span class="points-label">当前时间积分</span>
          </div>
        </div>
        <div class="points-card">
          <div class="points-icon">
            <font-awesome-icon icon="hand-holding-heart" />
          </div>
          <div class="points-info">
            <span class="points-value">24</span>
            <span class="points-label">本月服务时长(小时)</span>
          </div>
        </div>
        <div class="points-card">
          <div class="points-icon">
            <font-awesome-icon icon="medal" />
          </div>
          <div class="points-info">
            <span class="points-value">银牌志愿者</span>
            <span class="points-label">当前等级</span>
          </div>
        </div>
      </div>

      <!-- 服务选项 -->
      <div class="service-options">
        <div class="option-card provide">
          <div class="option-header">
            <font-awesome-icon icon="hands-helping" class="option-icon" />
            <h2>提供服务</h2>
          </div>
          <p>通过提供服务获取时间积分</p>
          <div class="service-list">
            <div class="service-item">
              <font-awesome-icon icon="user-friends" />
              <span>陪伴聊天</span>
              <span class="points">+2分/小时</span>
            </div>
            <div class="service-item">
              <font-awesome-icon icon="chalkboard-teacher" />
              <span>技能教学</span>
              <span class="points">+3分/小时</span>
            </div>
            <div class="service-item">
              <font-awesome-icon icon="hand-holding-medical" />
              <span>生活照料</span>
              <span class="points">+4分/小时</span>
            </div>
          </div>
          <button class="action-btn provide-btn">我要提供服务</button>
        </div>

        <div class="option-card exchange">
          <div class="option-header">
            <font-awesome-icon icon="exchange-alt" class="option-icon" />
            <h2>兑换服务</h2>
          </div>
          <p>使用积分兑换所需服务</p>
          <div class="service-list">
            <div class="service-item">
              <font-awesome-icon icon="home" />
              <span>居家照护</span>
              <span class="points">-4分/小时</span>
            </div>
            <div class="service-item">
              <font-awesome-icon icon="utensils" />
              <span>助餐服务</span>
              <span class="points">-2分/次</span>
            </div>
            <div class="service-item">
              <font-awesome-icon icon="hospital" />
              <span>医疗陪护</span>
              <span class="points">-5分/次</span>
            </div>
          </div>
          <button class="action-btn exchange-btn">我要兑换服务</button>
        </div>
      </div>

      <!-- 服务记录 -->
      <div class="service-history">
        <h2>近期服务记录</h2>
        <div class="history-list">
          <div class="history-item">
            <div class="history-icon">
              <font-awesome-icon icon="user-friends" />
            </div>
            <div class="history-content">
              <div class="history-header">
                <h3>陪伴聊天服务</h3>
                <span class="history-points">+4分</span>
              </div>
              <p>为张阿姨提供2小时陪伴服务</p>
              <div class="history-meta">
                <span><font-awesome-icon icon="calendar" /> 2024-06-10</span>
                <span><font-awesome-icon icon="clock" /> 14:00-16:00</span>
              </div>
            </div>
          </div>

          <div class="history-item">
            <div class="history-icon">
              <font-awesome-icon icon="chalkboard-teacher" />
            </div>
            <div class="history-content">
              <div class="history-header">
                <h3>手机使用教学</h3>
                <span class="history-points">+6分</span>
              </div>
              <p>教授李叔叔使用智能手机</p>
              <div class="history-meta">
                <span><font-awesome-icon icon="calendar" /> 2024-06-08</span>
                <span><font-awesome-icon icon="clock" /> 09:30-11:30</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TimeBank',
};
</script>

<style scoped>
.time-bank {
  padding: 40px;
  background-color: #f8f9fa;
  min-height: 100vh;
}

.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-header h1 {
  font-size: 32px;
  color: #2c3e50;
  margin-bottom: 10px;
}

.subtitle {
  color: #6c757d;
  font-size: 18px;
}

.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 30px;
}

/* 积分概览样式 */
.points-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.points-card {
  background: white;
  border-radius: 16px;
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.points-icon {
  width: 60px;
  height: 60px;
  background: #e3f2fd;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1976d2;
  font-size: 24px;
}

.points-info {
  display: flex;
  flex-direction: column;
}

.points-value {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
}

.points-label {
  color: #6c757d;
  font-size: 14px;
  margin-top: 5px;
}

/* 服务选项样式 */
.service-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.option-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.option-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.option-icon {
  font-size: 24px;
}

.option-card.provide .option-icon {
  color: #42b983;
}

.option-card.exchange .option-icon {
  color: #1976d2;
}

.option-card h2 {
  color: #2c3e50;
  font-size: 24px;
  margin: 0;
}

.option-card p {
  color: #6c757d;
  margin-bottom: 20px;
}

.service-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.service-item svg {
  color: #6c757d;
}

.service-item span {
  color: #2c3e50;
}

.service-item .points {
  margin-left: auto;
  font-weight: 500;
}

.option-card.provide .points {
  color: #42b983;
}

.option-card.exchange .points {
  color: #e74c3c;
}

.action-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.provide-btn {
  background: #42b983;
  color: white;
}

.provide-btn:hover {
  background: #3aa876;
}

.exchange-btn {
  background: #1976d2;
  color: white;
}

.exchange-btn:hover {
  background: #1565c0;
}

/* 服务记录样式 */
.service-history {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.service-history h2 {
  color: #2c3e50;
  font-size: 24px;
  margin-bottom: 20px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.history-item {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
}

.history-icon {
  width: 50px;
  height: 50px;
  background: #e3f2fd;
  border-radius: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1976d2;
  font-size: 20px;
}

.history-content {
  flex: 1;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.history-header h3 {
  color: #2c3e50;
  font-size: 18px;
  margin: 0;
}

.history-points {
  color: #42b983;
  font-weight: 500;
}

.history-content p {
  color: #6c757d;
  margin-bottom: 10px;
}

.history-meta {
  display: flex;
  gap: 20px;
  color: #6c757d;
  font-size: 14px;
}

.history-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

@media (max-width: 768px) {
  .time-bank {
    padding: 20px;
  }

  .points-overview,
  .service-options {
    grid-template-columns: 1fr;
  }

  .history-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .history-header {
    flex-direction: column;
    gap: 10px;
  }

  .history-meta {
    justify-content: center;
  }
}
</style>